#/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2022/1/11 18:32
# @Author  : wf
# @Email   : wf@163.com
# @File    : xssshome_page.py
# @Software: PyCharm
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.action_chains import ActionChains
url = 'http://192.168.1.30/crm'
#定位用户名输入框
username_locator = (By.NAME, 'name')
#定位密码输入框
password_locator = (By.NAME, 'password')
#定位登录按钮
submit_locator = (By.NAME, 'submit')
#定位线索按钮
xiansuo_locator = (By.LINK_TEXT,'线索')
#定位新建线索
xiansuochi_locator = (By.CSS_SELECTOR,'body > div.container > div.page-header > ul > li:nth-child(2) > a')
#定位筛选条件下拉框
tiaojian_locator = (By.ID,'field')
#定位包含下拉框
baohan_locator = (By.ID,'condition')
#定位关键字输入框
guanjianzi_locator = (By.ID,'search')
#定位搜索按钮输入框
sousuo_locator = (By.ID,'dosearch')

#输入用户名
def input_username(self,username):
    self.driver.find_element(*username_locator).send_keys(username)
#输入密码
def input_password(self,password):
    self.driver.find_element(*password_locator).send_keys(password)
#点击登录
def input_submit(self,submit):
    self.driver.find_element(*submit_locator).click()
#点击线索
def input_xiansuo(self,xiansuo):
    self.driver.find_element(*xiansuo_locator).click()
#点击线索池
def input_xiansuochi(self,xiansuochi):
    self.driver.find_element(*xiansuochi_locator).click()
#输入框筛选条件
def input_tiaojian(self,tiaojian):
    self.Select(self.driver.find_element(*tiaojian_locator)).select_by_visible_text('公司名')
#输入筛选条件
def input_baocun(self,baocun):
    self.Select(self.driver.find_element(*baohan_locator)).select_by_visible_text('包含')
#输入关键字
def input_guanjianzi(self,guanjianzi):
    self.driver.find_element(*guanjianzi_locator).send_keys(guanjianzi)
#点击搜索按钮
def input_sousuo(self,sousuo):
    self.driver.find_element(*sousuo_locator).click()
